﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<ComeSeeThis_MVC2.Models.VehicleFormView>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Edit Vehicle
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <% Html.RenderPartial("SubMenu"); %>
    <h2>
        Edit Vehicle</h2>
    <table>
        <tr>
            <td width="550px">
                <%
                    ViewData["IsAdmin"] = User.IsInRole("SiteAdmin");
                    Html.RenderPartial("VehicleForm", ViewData); %>
            </td>
            <td valign="top">
                <fieldset>
                    <legend>Spur Gears:</legend>
                    <% using (Ajax.BeginForm("SubmitSpurGear", new AjaxOptions { UpdateTargetId = "SubmittedSpurGears" }))
                       { %>
                    <input type="hidden" id="vehicleId" name="vehicleId" value="<%: Model.VehicleId%>" />
                    <input type="text" id="spurGear" name="spurGear" style="width: 40px;" maxlength="3"  />
                    <input type="submit" value="Add Spur Gear" />
                        <% } %>
                </fieldset>
                <div id="SubmittedSpurGears">
                                       <% Html.RenderPartial("VehicleSpurList", Model.VehicleSpurs);%>

                </div>
            </td>
        </tr>
    </table>
    <div>
        <%: Html.ActionLink("Back to List", "Index") %>
    </div>
    <script src="../../Scripts/MicrosoftAjax.js" type="text/javascript"></script>
    <script src="../../Scripts/MicrosoftMvcAjax.js" type="text/javascript"></script>
</asp:Content>
